package com.hcf.admin.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hcf.admin.common.convention.result.Result;
import com.hcf.admin.remote.ShortLinkProjectService;
import com.hcf.admin.remote.dto.req.RecycleBinRecoverReqDTO;
import com.hcf.admin.remote.dto.req.RecycleBinRemoveReqDTO;
import com.hcf.admin.remote.dto.req.RecycleBinSaveReqDto;
import com.hcf.admin.remote.dto.resp.ShortLinkPageRespDTO;
import com.hcf.admin.service.RecycleBinService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/shortlink/admin/v1/recycle-bin")
public class RecycleBinController {

    @Autowired
    RecycleBinService recycleBinService;

    ShortLinkProjectService shortLinkProjectService = new ShortLinkProjectService(){};

    @RequestMapping("/save")
    public Result<Void> saveRecycleBin(@RequestBody RecycleBinSaveReqDto requestParam){
        return shortLinkProjectService.saveRecycleBin(requestParam);
    }

    @RequestMapping("/page")
    public Result<IPage<ShortLinkPageRespDTO>> pageShortLink(){
        return recycleBinService.pageShortLink();
    }


    @RequestMapping("/recover")
    public Result<Void> recoverShortLink(@RequestBody RecycleBinRecoverReqDTO requestParam){
        return shortLinkProjectService.revocerShortLink(requestParam);
    }

    @RequestMapping("/remove")
    public Result<Void> removeShortLink(@RequestBody RecycleBinRemoveReqDTO requestParam){
        return shortLinkProjectService.removeShortLink(requestParam);
    }
}
